package com.yfp.operation.controller;

import com.yfp.common.core.domain.R;
import com.yfp.common.core.domain.ResponseEnum;
import com.yfp.operation.domain.dto.LengthenDateDTO;
import com.yfp.operation.service.ClientCouponService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @version 1.0
 * @date 2024-07-13 11:57
 */
@RestController
@RequestMapping("/client/coupon")
@Tag(name = "营销活动-小程序")
public class ClientCouponController {

    @Resource
    private ClientCouponService clientCouponService;

    @GetMapping("/order/refund")
    @Operation(summary = "后台退优惠券", description = "后台退优惠券")
    public R<Void> refund(String orderListId) {
        clientCouponService.refund(orderListId);
        return R.ok();
    }

    @PostMapping("/lengthen")
    @Operation(summary = "延长时间")
    public R<Void> lengthen(@RequestBody LengthenDateDTO lengthenDateDTO) {
        clientCouponService.lengthen(lengthenDateDTO);
        return R.ok();
    }


    @Operation(summary = "核销券")
    @PostMapping("/verification/{marCouponExportId}")
    public R<ResponseEnum> verification(@PathVariable("ccId") Long ccId) {
        return R.ok(clientCouponService.verification(ccId));
    }





    @PutMapping("/storedCoupon/expire")
    @Operation(summary = "储值活动优惠券失效")
    public R<Void> storedCouponExpire(@RequestParam("cbId") Long cbId){
        clientCouponService.storedCouponExpire(cbId);
        return R.ok();
    }


}
